<?php

namespace App\Model;

use App\Comment\Comment;
use Illuminate\Database\Eloquent\Model;

class MallStoreGoodsClass extends Model
{
    public $timestamps = false;
    protected $table = 'mall_store_goods_class';

    /**
     * 获取店铺分类的信息列表
     * @return mixed
     */
    public function getGoodsClassList()
    {
        return $this -> where(['store_id' => Comment::getBizId(), 'sgc_state' => 1]) -> get() -> toArray();
    }

    /**
     * 分页获取店铺分类的信息列表
     * @return mixed
     */
    public function getGoodsClassListPage()
    {
        return $this -> where(['store_id' => Comment::getBizId(), 'sgc_state' => 1]) -> paginate(20) -> toArray();
    }

    /**
     * 添加菜品分类
     * @param $data
     * @return mixed
     */
    public function addStoreGoodsClass($data)
    {
        return $this -> insert($data);
    }

    /**
     * 根据条件修改菜品分类
     * @param $where
     * @param $data
     * @return mixed
     */
    public function updateStoreGoodsClass($where, $data)
    {
        return $this -> where($where) -> update($data);
    }
}
